package pri.black.garden.controller;

import java.util.List;
import java.util.Arrays;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pri.black.dogview.domain.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import pri.black.garden.domain.VegetablesInstanceLog;
import pri.black.garden.service.IVegetablesInstanceLogService;
import pri.black.garden.biz.VegetablesInstanceLogBiz;

/**
 * gardenController
 * 
 * @author black
 * @date 2025-01-21
 */
@RestController
@RequestMapping("/garden/vegetables-instance-log")
public class VegetablesInstanceLogController
{
    @Autowired
    private VegetablesInstanceLogBiz vegetablesInstanceLogBiz;

    /**
     * 查询garden列表
     */
    //@PreAuthorize("@ss.hasPermi('garden:garden:list')")
    @GetMapping("/list")
    public R list(Page<VegetablesInstanceLog> vegetablesInstanceLog)
    {
        Page<VegetablesInstanceLog> list = vegetablesInstanceLogBiz.getService().page(vegetablesInstanceLog);
        return R.ok(list);
    }

    /**
     * 获取garden详细信息
     */
    //@PreAuthorize("@ss.hasPermi('garden:garden:query')")
    @GetMapping(value = "/{id}")
    public R getInfo(@PathVariable("id") Long id)
    {
        return R.ok(vegetablesInstanceLogBiz.getService().getById(id));
    }

    /**
     * 新增garden
     */
    //@PreAuthorize("@ss.hasPermi('garden:garden:add')")
    //@Log(title = "garden", businessType = BusinessType.INSERT)
    @PostMapping
    public R add(@RequestBody VegetablesInstanceLog vegetablesInstanceLog)
    {
        return R.ok(vegetablesInstanceLogBiz.save(vegetablesInstanceLog));
    }

    /**
     * 修改garden
     */
    //@PreAuthorize("@ss.hasPermi('garden:garden:edit')")
    //@Log(title = "garden", businessType = BusinessType.UPDATE)
    @PutMapping
    public R edit(@RequestBody VegetablesInstanceLog vegetablesInstanceLog)
    {
        return R.ok(vegetablesInstanceLogBiz.update(vegetablesInstanceLog));
    }

    /**
     * 删除garden
     */
    //@PreAuthorize("@ss.hasPermi('garden:garden:remove')")
    //@Log(title = "garden", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R remove(@PathVariable Long[] ids)
    {
        return R.ok(vegetablesInstanceLogBiz.getService().removeByIds(Arrays.asList(ids)));
    }
}
